﻿Imports ISNet.WebUI.WebTreeView
Imports log4net

Partial Class Report_R17
    Inherits System.Web.UI.Page

    Public ScriptText As String = ""
    Private Shared logger As ILog = LogManager.GetLogger("Report_R17")

    Protected Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
        WebCombo3.EncodeOutput = True
    End Sub
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

        'Session("users") = "bb0011"
        'Session("PlanYear") = "2557"

        If Session("users") Is Nothing Then
            Response.Redirect("LoginForm.aspx")
        End If
        
        Label1.Text = "ระบบจัดทำงบประมาณ >> รายงาน >> รายงานโครงการและงานสนับสนุน"
        If IsPostBack = False Then
            DropDownList1.Items(0).Selected = True
            Session.Remove("FCTRgroup")
            Session("FCTRgroup") = DropDownList1.SelectedValue
            Try
                Dim adap As New DBdataTableAdapters.AppConfigsTableAdapter
                Dim dt As New DBdata.AppConfigsDataTable
                dt = adap.GetData
                For Each item As DBdata.AppConfigsRow In dt
                    Select Case item.Name
                        Case "ACTIVE_PLAN_YEAR"
                            PlanYearsTxt.Text = item.Value
                    End Select
                Next

                Dim role_type As String = ""
                Dim usadap As New UserDSTableAdapters.Users2TableAdapter
                role_type = usadap.GetRoleType(role_type)
                Dim vtext As String = "1"
                Select Case role_type
                    Case "2"
                        vtext = "1"
                    Case "3"
                        vtext = "2"
                    Case "4"
                        vtext = "3"
                    Case "5"
                        vtext = "4"
                    Case Else
                        vtext = "1"
                End Select
                VersionTxt.Text = vtext

                Dim adapter As New AttachmentTableAdapters.ProjectsTableAdapter
                Dim data As New Attachment.ProjectsDataTable
                'data = adapter.GetDataByPlanYear(Val(Session("PlanYear")))
                Dim sql = ""
                Dim prefil As String = ""

                prefil = Session("prefilter")
                sql += " WHERE 1 = 1 "
                sql += " AND PlanYear = " & PlanYearsTxt.Text & " "
                If prefil <> "" Then
                    sql += " AND FundCenter_FundCenterCode IN (" & prefil & ") "
                End If
                'sql += " AND LEFT(ProjectCode,1) = '" & Request("ptype") & "' "
                sql += " UNION  "
                sql += " SELECT ProjectCode, PlanYear, (Description) AS Description , CreatedDate, UpdatedDate, CreatedBy, UpdatedBy, FundCenter_FundCenterCode "
                sql += " FROM Projects AS Projects1 "
                sql += " WHERE Projects1.FundCenter_FundCenterCode IS NULL "
                sql += " AND Projects1.PlanYear = " & PlanYearsTxt.Text & " "
                'sql += " AND LEFT(Projects1.ProjectCode,1) = '" & Request("ptype") & "' "
                adapter.GetDataByFilter(data, sql)
                ms8.DataValueField = "ProjectCode"
                ms8.DataTextField = "Description"
                ms8.DataSource = data
                ms8.DataBind()

            Catch ex As Exception
                logger.Error(ex.Message)
                logger.Error(ex.StackTrace)
            End Try
        End If

        GenerateValues()
        'Label1.Text = Date.Now.AddYears(543).Year
        'PlotNode()
        PlotCmmtNode()
    End Sub


    Sub GenerateValues()
        If hdf1.Value.Length = 0 Then
            Session("Search") = "false"
        End If
        Try
            Dim Numx As Array = hdf1.Value.Split(",")
            For i = 0 To Numx.Length - 1
                ms8.Items.FindByValue(Numx(i).ToString).Selected = True
            Next
        Catch ex As Exception
            logger.Error(ex.Message)
            logger.Error(ex.StackTrace)
        End Try
    End Sub

    Sub PlotNode()

        Dim MyNode As WebTreeViewNode
        MyNode = New WebTreeViewNode()

        Dim adapter As New FundCenterParentTableAdapters.fctr_viewTableAdapter
        Dim dt As New FundCenterParent.fctr_viewDataTable
        dt = adapter.GetDataByUser(Session("users"), Val(PlanYearsTxt.Text))

        Dim root_id As String

        MyNode.Text = "GSB"
        MyNode.Value = "0"
        root_id = "0"

        If dt.Count > 0 Then

            WebTreeView3.Nodes.Add(MyNode)

            Dim rootpath = ""
            rootpath = FctrClass.GetRoot(Session("users"), Val(Session("planyear")))
            Dim rootarr() As String = Split(rootpath, ",")
            WebTreeView3.Nodes.Add(MyNode)

            For i = 0 To rootarr.Length - 1
                PlotChild(rootarr(i), MyNode, 1)
            Next
        End If

    End Sub

    Sub PlotChild(ByVal gpath As String, ByRef cnode As WebTreeViewNode, ByVal level As Decimal)
        'Response.Write(gpath & "<br>")
        Dim Hadapter As New FundCenterParentTableAdapters.FctHTableAdapter
        Dim Hdatatable As New FundCenterParent.FctHDataTable
        Hdatatable = Hadapter.GetDataByGPath(gpath, Val(Session("planyear")))

        Dim MyNode As WebTreeViewNode
        MyNode = New WebTreeViewNode()
        For Each row As FundCenterParent.FctHRow In Hdatatable


            MyNode.Text = row.Description
            MyNode.Value = row.FundCenter_FundCenterCode

            cnode.Nodes.Add(MyNode)
        Next


        If Len(gpath) >= 10 Then
            Exit Sub
        End If

        Dim hadap2 As New FundCenterParentTableAdapters.UserLikeGpathTableAdapter
        Dim hdt2 As New FundCenterParent.UserLikeGpathDataTable
        Dim sql As String = ""
        Dim prefil As String = ""
        prefil = ""

        Dim pathadd As String = "__"
        'For i = 1 To 4
        sql = ""
        Dim fullpath As String = gpath & pathadd
        If prefil <> "" Then
            sql += " AND fctr_view.FundCenterCode IN (" & prefil & ") "
        End If
        sql += " AND grouppath like '" & fullpath & "' "
        sql += " and USERNAME = '" & Session("users") & "' AND fctr_view.PlanYear = " & Val(Session("PlanYear")) & " AND Fcth.PlanYear = " & Val(Session("PlanYear"))
        hadap2.GetDataByFilter(hdt2, sql)

        For Each row As FundCenterParent.UserLikeGpathRow In hdt2
            If Len(row.grouppath) <= 10 Then
                PlotChild(row.grouppath, MyNode, level + 1)
            End If

        Next

    End Sub

    Sub PlotCmmtNode()

        Dim MyNode As WebTreeViewNode
        MyNode = New WebTreeViewNode()

        Dim adapter As New CmmtHierachyDSTableAdapters.CmmtHierarchiesTableAdapter
        Dim dt As New CmmtHierachyDS.CmmtHierarchiesDataTable
        dt = adapter.GetLevel1(Val(PlanYearsTxt.Text))

        Dim root_id As String

        MyNode.Text = "ทุกรายการ"
        MyNode.Value = "0"
        root_id = "0"

        If dt.Count > 0 Then

            WebTreeView4.Nodes.Add(MyNode)


            For Each item As CmmtHierachyDS.CmmtHierarchiesRow In dt
                Dim MyNode1 As WebTreeViewNode
                Dim dt1 As New CmmtHierachyDS.CmmtHierarchiesDataTable
                MyNode1 = New WebTreeViewNode()
                MyNode1.Text = item.Description
                MyNode1.Value = item.Id
                MyNode.Nodes.Add(MyNode1)
                dt1 = adapter.GetDataByParentID(item.Id, Val(PlanYearsTxt.Text), DropDownList2.SelectedValue)
                If dt1.Count > 0 Then
                    For Each item2 As CmmtHierachyDS.CmmtHierarchiesRow In dt1
                        Dim MyNode2 As WebTreeViewNode
                        Dim dt2 As New CmmtHierachyDS.CmmtHierarchiesDataTable
                        MyNode2 = New WebTreeViewNode()
                        MyNode2.Text = item2.Description
                        MyNode2.Value = item2.Id
                        MyNode1.Nodes.Add(MyNode2)
                        dt2 = adapter.GetDataByParentID(item2.Id, Val(PlanYearsTxt.Text), DropDownList2.SelectedValue)
                        If dt2.Count > 0 Then
                            For Each item3 As CmmtHierachyDS.CmmtHierarchiesRow In dt2
                                Dim MyNode3 As WebTreeViewNode
                                MyNode3 = New WebTreeViewNode()
                                MyNode3.Text = If(item3.IsDescriptionNull, "", item3.Description) & " " & If(item3.IsCmmt_CmmtCodeNull, "", item3.Cmmt_CmmtCode)
                                MyNode3.Value = item3.Id
                                MyNode2.Nodes.Add(MyNode3)
                            Next
                        End If
                    Next


                End If

            Next
        End If
        WebTreeView4.ExpandAll()
    End Sub

    Protected Sub WebCb_ActivityTypeFrom_InitializeDataSource(sender As Object, e As ISNet.WebUI.WebCombo.DataSourceEventArgs)
        Dim adapter As New Data_ReportTableAdapters.ActivityTypesTableAdapter
        Dim data As New Data_Report.ActivityTypesDataTable

        data = adapter.GetDataByPlanYear(Val(Session("planyear")))
        ' data.Rows.Add("0", "ทุกรายการ", "1", "0")
        data.DefaultView.Sort = "ActivityTypeCode"
        e.DataSource = data
    End Sub

    Protected Sub WebCombo1_InitializeDataSource(sender As Object, e As ISNet.WebUI.WebCombo.DataSourceEventArgs) Handles WebCombo1.InitializeDataSource

        'If Session("Versions") > 1 Then
        'ds = PublicFunction.GetChild2(Session("users"))
        'ds.Tables(0).DefaultView.Sort = "FundCenterCode ASC"
        'e.DataSource = ds
        Dim adap As New BasicDataTableAdapters.FCTR_Child2TableAdapter
        Dim dt As New BasicData.FCTR_Child2DataTable
        Dim sql = ""
        Dim prefil As String = ""
        'prefil = Session("prefilter")
        Dim enableAllReport As Boolean = False
        enableAllReport = Session("EnableAllReport")
        If enableAllReport Then
            sql += " WHERE 1 = 1 "
           
            sql += " and FundCenters.PlanYear = " & Val(Session("planyear"))
            sql += " and fctr_view.PlanYear = " & Val(Session("planyear"))
            sql += " and FundCenterHierarchies.FundCenterGroup = " & Session("FCTRgroup")
            sql += " and FundCenterHierarchies.PlanYear = " & Val(Session("planyear")) & " "
            sql += " and fctr_view.ParentFundCenter = 0 "
            sql += " GROUP BY fctr_view.FundCenterCode, FundCenters.Description, FundCenterHierarchies.Level,fctr_view.ParentFundCenter "

            sql += " ORDER BY FundCenterCode ASC"
        Else
            sql += " WHERE 1 = 1 "
            sql += " AND UserName = '" & Session("users") & "'"
            'If prefil <> "" Then
            '    sql += " AND fctr_view.FundCenterCode IN (" & prefil & ") "
            'End If


            sql += " and FundCenters.PlanYear = " & Val(Session("planyear"))
            sql += " and fctr_view.PlanYear = " & Val(Session("planyear"))
            sql += " and FundCenterHierarchies.FundCenterGroup = " & Session("FCTRgroup")
            sql += " and FundCenterHierarchies.PlanYear = " & Val(Session("planyear")) & " "
            sql += " ORDER BY FundCenterCode ASC"
        End If
        
        adap.GetDataByFilter(dt, sql)
        dt.Rows.Add("", "ทุกรายการ", "1", "0")
        dt.DefaultView.Sort = "FundCenterCode"
        e.DataSource = dt



        'Else
        'Dim adap As New BasicDataTableAdapters.FCTR_ChildTableAdapter
        'Dim dt As New BasicData.FCTR_ChildDataTable
        'dt = adap.GetOwnData(Session("FCTR"))
        'e.DataSource = dt
        'End If
    End Sub

    Protected Sub WebCombo2_InitializeDataSource(sender As Object, e As ISNet.WebUI.WebCombo.DataSourceEventArgs) Handles WebCombo2.InitializeDataSource

        'If Session("Versions") > 1 Then
        'ds = PublicFunction.GetChild2(Session("users"))
        'ds.Tables(0).DefaultView.Sort = "FundCenterCode ASC"
        'e.DataSource = ds
        Dim adap As New BasicDataTableAdapters.FCTR_Child2TableAdapter 'Data_ReportTableAdapters.FCTRReportTableAdapter  '
        Dim dt As New BasicData.FCTR_Child2DataTable 'Data_Report.FCTRReportDataTable '


        Dim sql = ""
        Dim prefil As String = ""
        'prefil = Session("prefilter")
        Dim enableAllReport As Boolean = False
        enableAllReport = Session("EnableAllReport")
        If enableAllReport Then
            sql += " WHERE 1 = 1 "
            
            sql += " and FundCenters.PlanYear = " & Val(Session("planyear"))
            sql += "  and fctr_view.PlanYear = " & Val(Session("planyear"))
            sql += " and FundCenterHierarchies.FundCenterGroup = " & Session("FCTRgroup")
            sql += " and FundCenterHierarchies.PlanYear = " & Val(Session("planyear")) & " "
            sql += " and fctr_view.ParentFundCenter = 0 "
            sql += " GROUP BY fctr_view.FundCenterCode, FundCenters.Description, FundCenterHierarchies.Level,fctr_view.ParentFundCenter "

            sql += " ORDER BY FundCenterCode ASC"
        Else
            sql += " WHERE 1 = 1 "
            sql += " AND UserName = '" & Session("users") & "'"
            'If prefil <> "" Then
            '    sql += " AND fctr_view.FundCenterCode IN (" & prefil & ") "
            'End If

            sql += " and FundCenters.PlanYear = " & Val(Session("planyear"))
            sql += "  and fctr_view.PlanYear = " & Val(Session("planyear"))
            sql += " and FundCenterHierarchies.FundCenterGroup = " & Session("FCTRgroup")
            sql += " and FundCenterHierarchies.PlanYear = " & Val(Session("planyear")) & " "
            sql += " ORDER BY FundCenterCode ASC"
        End If
        
        adap.GetDataByFilter(dt, sql)
        dt.Rows.Add("", "ทุกรายการ", "1", "0")
        dt.DefaultView.Sort = "FundCenterCode"
        e.DataSource = dt


        'Else
        'Dim adap As New BasicDataTableAdapters.FCTR_ChildTableAdapter
        'Dim dt As New BasicData.FCTR_ChildDataTable
        'dt = adap.GetOwnData(Session("FCTR"))
        'e.DataSource = dt
        'End If
    End Sub


    Protected Sub toReport_Click(sender As Object, e As ImageClickEventArgs) Handles toReport.Click
        If Val(PlanYearsTxt.Text) = 0 Then
            ScriptText = "<script language='javascript'>alert('กรุณาระบุปีงบประมาณ');</script>"
            Exit Sub
        End If
        If VersionTxt.Text.Trim = "" Then
            ScriptText = "<script language='javascript'>alert('กรุณาระบุ Version');</script>"
            Exit Sub
        End If
        Session.Remove("year")
        Session.Add("year", PlanYearsTxt.Text)

        Session.Remove("version")
        Session.Add("version", VersionTxt.Text)

        Session.Remove("FundcenterAll")

        'Add by Orn 18/08/2558
        Session.Remove("ActivityTypeS")
        Session.Add("ActivityTypeS", WebCb_ActivityTypeFrom.Value)
        Session.Remove("ActivityTypeE")
        Session.Add("ActivityTypeE", WebCb_ActivityTypeTo.Value)

        'Add by Orn 28/4/2558
        Dim useradap As New UserDSTableAdapters.UsersTableAdapter()
        Dim userDS As New UserDS.UsersDataTable
        userDS = useradap.GetDataByUsername(Session("users"))
        Dim enableAllUser As Boolean = False
        If userDS.Rows.Count > 0 Then
            If userDS(0)("Enable_All_Report_Flag").ToString() <> "" Then
                enableAllUser = userDS(0)("Enable_All_Report_Flag")
            End If
        End If
        If TabContainer1.ActiveTab.ID = TabPanel1.ID Then
            Session.Remove("FCTRmode")
            Session.Add("FCTRmode", "1")
            Session.Remove("FundcenterAll")
            If enableAllUser = True Then
                Session.Add("FundcenterAll", FctrClass.GetFromToFundCenterReport(WebCombo1.Value, WebCombo2.Value, Val(Session("year"))))
            Else
                'If WebCombo1.Value <> "" And WebCombo2.Value = "" Then
                '    Session.Add("FundcenterAll", FctrClass.GetFromToFundCenterReport(WebCombo1.Value, WebCombo1.Value, Val(Session("year"))))
                'ElseIf WebCombo1.Value = "" And WebCombo2.Value <> "" Then
                '    Session.Add("FundcenterAll", FctrClass.GetFromToFundCenterReport(WebCombo2.Value, WebCombo2.Value, Val(Session("year"))))
                'Else
                '    Session.Add("FundcenterAll", FctrClass.GetUserFundCenter(Session("users"), Val(Session("year"))))
                'End If
                'Edit by Orn 10/08/2558
                Session.Add("FundcenterAll", FctrClass.GetUserFundCenterFromTo(Session("users"), Val(Session("year")), WebCombo1.Value, WebCombo2.Value))
            End If
        ElseIf TabContainer1.ActiveTab.ID = TabPanel2.ID Then
            Session.Remove("FCTRmode")
            Session.Add("FCTRmode", "2")
            If WebCombo3.Value <> "" Then
                If WebCombo3.Value <> 0 Then
                    Session.Add("FundcenterAll", FctrClass.GetSubFundCenterrReport(WebCombo3.Value, Session("users"), Val(Session("year")), ""))
                Else
                    If enableAllUser = True Then
                        Session.Add("FundcenterAll", FctrClass.GetUserFundCenter(Val(Session("year"))))
                    Else
                        Session.Add("FundcenterAll", FctrClass.GetUserFundCenter(Session("users"), Val(Session("year"))))
                    End If
                End If
            Else
                If enableAllUser = True Then
                    Session.Add("FundcenterAll", FctrClass.GetUserFundCenter(Val(Session("year"))))
                Else
                    Session.Add("FundcenterAll", FctrClass.GetUserFundCenter(Session("users"), Val(Session("year"))))
                End If
            End If
        End If
        'End Add by Orn 28/4/2558

        'If TabContainer1.ActiveTab.ID = TabPanel1.ID Then
        '    Session.Remove("FCTRmode")
        '    Session.Add("FCTRmode", "1")
        '    'Session.Add("FundcenterS", WebCombo1.Value)
        '    'Session.Add("FundcenterE", WebCombo2.Value)
        '    Session.Remove("FundcenterAll")
        '    If WebCombo1.Value <> "" And WebCombo2.Value <> "" Then
        '        Session.Add("FundcenterAll", FctrClass.GetFromToFundCenter(WebCombo1.Value, WebCombo2.Value, Session("users"), Val(Session("year"))))
        '        'Response.Write(FctrClass.GetFromToFundCenter(WebCombo1.Value, WebCombo2.Value, Session("users")))
        '    ElseIf WebCombo1.Value <> "" And WebCombo2.Value = "" Then
        '        Session.Add("FundcenterAll", FctrClass.GetFromToFundCenter(WebCombo1.Value, WebCombo1.Value, Session("users"), Val(Session("year"))))
        '        'Response.Write(FctrClass.GetFromToFundCenter(WebCombo1.Value, WebCombo1.Value, Session("users")))
        '    ElseIf WebCombo1.Value = "" And WebCombo2.Value <> "" Then
        '        Session.Add("FundcenterAll", FctrClass.GetFromToFundCenter(WebCombo2.Value, WebCombo2.Value, Session("users"), Val(Session("year"))))
        '        'Response.Write(FctrClass.GetFromToFundCenter(WebCombo2.Value, WebCombo2.Value, Session("users")))
        '    Else
        '        Session.Add("FundcenterAll", FctrClass.GetUserFundCenter(Session("users"), Val(Session("year"))))
        '    End If


        'ElseIf TabContainer1.ActiveTab.ID = TabPanel2.ID Then
        '    Session.Remove("FCTRmode")
        '    Session.Add("FCTRmode", "2")
        '    If WebCombo3.Value <> "" Then
        '        Session.Add("FundcenterAll", FctrClass.GetSubFundCenter(WebCombo3.Value, Session("users"), Val(Session("year")), ""))
        '    Else
        '        Session.Add("FundcenterAll", FctrClass.GetUserFundCenter(Session("users"), Val(Session("year"))))
        '    End If

        'End If

        If TabContainer2.ActiveTab.ID = TabPanel3.ID Then
            Session.Remove("CmmtCodeS")
            Session.Add("CmmtCodeS", CmmtCodeS2.Value)

            Session.Remove("CmmtCodeE")
            Session.Add("CmmtCodeE", CmmtCodeE2.Value)

            Session.Remove("CmmtMode")
            Session.Add("CmmtMode", "1")
        ElseIf TabContainer2.ActiveTab.ID = TabPanel4.ID Then
            Session.Remove("CmmtParent")
            Session.Add("CmmtParent", WebCombo4.Value.ToString)

            Session.Remove("CmmtMode")
            Session.Add("CmmtMode", "2")
        End If

        Session.Remove("Project_ProjectCode")
        Session.Add("Project_ProjectCode", hdf1.Value.ToString)



       

        ScriptText = "<script language='javascript'>openpop();</script>"

        'Response.Write(FundcenterS.Value & "/" & FundcenterE.Value & "/" & CmmtCodeS.SelectedValue & "/" & CmmtCodeE.SelectedValue)

        'Response.Redirect("./Report/RP02.aspx")
        'ScriptText = "<script language='javascript'> window.open('./Report/RP02.aspx','','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no')</script>"


    End Sub

    Protected Sub DropDownList2_SelectedIndexChanged(sender As Object, e As EventArgs)
        PlotCmmtNode()
    End Sub

    Protected Sub CmmtCodeS2_InitializeDataSource(sender As Object, e As ISNet.WebUI.WebCombo.DataSourceEventArgs) Handles CmmtCodeS2.InitializeDataSource, CmmtCodeE2.InitializeDataSource
        Dim adap As New Data_ReportTableAdapters.CmmtDataTableAdapter
        Dim dt As New Data_Report.CmmtDataDataTable
        dt = adap.GetData(Val(PlanYearsTxt.Text))
        e.DataSource = dt
    End Sub

    Protected Sub WebCombo3_InitializeDataSource(sender As Object, e As ISNet.WebUI.WebCombo.DataSourceEventArgs) Handles WebCombo3.InitializeDataSource

        Dim adap As New FundCenterParentTableAdapters.SelectorTableAdapter
        Dim dt As New FundCenterParent.SelectorDataTable
        Dim dt2 As New FundCenterParent.SelectorDataTable
        Dim sql = ""
        'Dim prefil As String = ""
        'prefil = Session("prefilter")
        Dim enableAllReport As Boolean = False
        enableAllReport = Session("EnableAllReport")
        If enableAllReport Then
            sql += " WHERE 1 = 1 "
            sql += " AND fctr_view.PlanYear = " & Val(Session("PlanYear")) & " AND FctH.PlanYear = " & Val(Session("PlanYear"))
            
            sql += " and FctH.fundcentergroup = " & Session("FCTRgroup")
            sql += " GROUP BY  FctH.Description, FctH.FundCenter_FundCenterCode, FctH.ParentFundCenterHierarchy_Id"
            sql += ", FctH.grouppath,  FctH.pathname, FctH.planyear "

            sql += " ORDER BY Grouppath"
        Else
            sql += " WHERE 1 = 1 "
            sql += " and USERNAME = '" & Session("users") & "' AND fctr_view.PlanYear = " & Val(Session("PlanYear")) & " AND FctH.PlanYear = " & Val(Session("PlanYear"))
            'If prefil <> "" Then
            '    sql += " AND fctr_view.FundCenterCode IN (" & prefil & ") "
            'End If
            sql += " and FctH.fundcentergroup = " & Session("FCTRgroup")
            sql += " ORDER BY Grouppath"
        End If
       
        adap.GetDataByFilter(dt2, sql)
        dt.Rows.Add("ทุกรายการ", "0", 0, "0", Val(Session("PlanYear")), "ทุกรายการ")
        dt.Merge(dt2)
        'dt.DefaultView.Sort = "FundCenter_FundCenterCode"
        e.DataSource = dt



    End Sub

    Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DropDownList1.SelectedIndexChanged
        Session("FCTRgroup") = DropDownList1.SelectedValue
        WebCombo1.ClearCachedDataSource()
        WebCombo1.DataBind()
        WebCombo2.ClearCachedDataSource()
        WebCombo2.DataBind()
        WebCombo3.ClearCachedDataSource()
        WebCombo3.DataBind()
    End Sub
End Class
